
import socket
import os
import json

sk = socket.socket()
sk.connect(('127.0.0.1', 9000))

file_path = input('>>>')
if os.path.isabs(file_path):
    file_name = os.path.basename(file_path)
    file_name_dic = {'file_name': file_name}
    str_dic = json.dumps(file_name_dic)
    sk.send(str_dic.encode('utf-8'))
    with open(file_path, 'rb') as f:
        content = f.read()
        sk.send(content)

sk.close()